package com.juc.juc_project.publish;

import com.juc.juc_project.annoations.NotRecommend;
import lombok.extern.slf4j.Slf4j;

import javax.annotation.concurrent.NotThreadSafe;

@Slf4j
@NotThreadSafe
@NotRecommend
public class Escape {

    private int thisCanBeEscape = 0;

    public Escape () {
        new InnerClass();
        this.thisCanBeEscape=1;
    }

    private class InnerClass {
        //Escape类的实例化对象还没有被实例化，就被使用了 ---》对象逃逸
        public InnerClass() {
            log.info("{}", Escape.this.thisCanBeEscape);
        }
    }

    public static void main(String[] args) {
       // InnerClass innerClass = new InnerClass();
        new Escape();
    }
}
